package org.jeecg.modules.gudingzichan.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.jeecg.modules.gudingzichan.entity.Gudingzichan;
import org.jeecg.modules.gudingzichan.service.IGudingzichanService;
import org.jeecg.modules.hqbaoxiao.entity.HqBaoxiao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UpdateGudzczt implements JavaDelegate {
    @Autowired
    private IGudingzichanService gudingzichanService;

    @Override
    public void execute(DelegateExecution delegateExecution) {
        String busKey = delegateExecution.getProcessInstanceBusinessKey();

        Gudingzichan gudingzichan = gudingzichanService.getById(busKey);
        if(gudingzichan != null) {
            // 移交流程
            if(gudingzichan.getZichanStatus().equals("3")) {
                gudingzichanService.removeById(gudingzichan.getId());
                log.info("移交流程，删除固定资产记录, {}", gudingzichan.getBianhao());
                return;
            }
        }
    }
}

